<!DOCTYPE html>
<html lang="en" class="page-fill" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="shortcut icon" th:href="@{/image/favicon.ico}" type="image/x-icon"/>
    <link  th:href="@{/css/oksub.css}" rel="stylesheet" type="text/css" />
    <script type="text/javascript" th:src="@{/lib/loading/okLoading.js}"></script>
</head>
<body class="page-fill">
    <div class="page-fill" id="login">
        <form class="layui-form" th:action="@{/login}">
            <div class="login_face"><img th:src="@{image/logo.png}"></div>
            <span th:if="${msg}!=null" style="color:red;" > [[${msg}]]</span>
            <div class="layui-form-item input-item">
                <label for="username">账号</label>
                <input type="text" lay-verify="required" name="username" placeholder="请输入账号" autocomplete="off" id="username" class="layui-input">
            </div>
            <div class="layui-form-item input-item">
                <label for="password">密码</label>
                <input type="password" lay-verify="required|password" name="password" placeholder="请输入密码" autocomplete="off" id="password" class="layui-input">
            </div>
            <div class="layui-form-item">
                <button class="layui-btn layui-block" type="submit">登录</button>
            </div>
            <div class="login-link">
                <a th:href="@{/toRegister}">注册</a>
                <a th:href="@{/toForget}">忘记密码?</a>
            </div>
        </form>
    </div>
</body>
<!--js逻辑-->
<script th:src="@{/lib/layui/layui.js}"></script>
<script>
    layui.use(["form", "okGVerify", "okUtils", "okLayer"], function () {
        let $ = layui.jquery;

        okLoading.close($);

        /**
         * 表单input组件单击时
         */
        $("#login .input-item .layui-input").click(function (e) {
            e.stopPropagation();
            $(this).addClass("layui-input-focus").find(".layui-input").focus();
        });

        /**
         * 表单input组件获取焦点时
         */
        $("#login .layui-form-item .layui-input").focus(function () {
            $(this).parent().addClass("layui-input-focus");
        });

        /**
         * 表单input组件失去焦点时
         */
        $("#login .layui-form-item .layui-input").blur(function () {
            $(this).parent().removeClass("layui-input-focus");
            if ($(this).val() != "") {
                $(this).parent().addClass("layui-input-active");
            } else {
                $(this).parent().removeClass("layui-input-active");
            }
        })
        return false;
    });
</script>
</html>
